package cn.hg.solon.youcan.system.provider;

import java.util.List;
import java.util.Map;

import org.dromara.hutool.db.PageResult;
import org.noear.solon.annotation.ProxyComponent;
import org.noear.solon.data.annotation.Tran;

import com.easy.query.api4j.client.EasyQuery;
import com.easy.query.solon.annotation.Db;

import cn.hg.solon.youcan.system.entity.Config;
import cn.hg.solon.youcan.system.entity.EqConfig;
import cn.hg.solon.youcan.system.service.ConfigService;

/**
 * @author 胡高
 * @date 2023/08/03
 */
@ProxyComponent
public class EqConfigProvider implements ConfigService {

    @Db("db1")
    private EasyQuery easyQuery;

    /* (non-Javadoc)
     * @see cn.hg.solon.youcan.system.service.ConfigService#checkUnique(cn.hg.solon.youcan.system.entity.Config)
     */
    @Override
    public boolean checkUnique(Config bean) {
        // TODO Auto-generated method stub
        return false;
    }

    /* (non-Javadoc)
     * @see cn.hg.solon.youcan.system.service.ConfigService#remove(java.util.List)
     */
    @Tran
    @Override
    public boolean delete(List<Integer> idList) {
        // TODO Auto-generated method stub
        return false;
    }

    /* (non-Javadoc)
     * @see cn.hg.solon.youcan.system.service.ConfigService#get(java.lang.Integer)
     */
    @Override
    public Config get(Integer id) {
        // TODO Auto-generated method stub
        return null;
    }

    /* (non-Javadoc)
     * @see cn.hg.solon.youcan.system.service.ConfigService#getByTypeAndCode(java.lang.String, java.lang.String)
     */
    @Override
    public Config getByTypeAndCode(String type, String code) {
        EqConfig bean = this.easyQuery.queryable(EqConfig.class)
            .where(o -> o.eq(EqConfig::getType, type).eq(EqConfig::getCode, code)).firstOrNull();
        return bean;
    }

    /* (non-Javadoc)
     * @see cn.hg.solon.youcan.system.service.ConfigService#save(cn.hg.solon.youcan.system.entity.Config)
     */
    @Tran
    @Override
    public boolean insert(Config bean) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public List<? extends Config> listByType(String type) {
        return this.easyQuery.queryable(EqConfig.class).where(o -> o.eq(EqConfig::getType, type)).toList();
    }

    /* (non-Javadoc)
     * @see cn.hg.solon.youcan.system.service.ConfigService#pageBy(int, int, java.util.Map)
     */
    @Override
    public PageResult<? extends Config> pageBy(int pageNumber, int pageSize, Map<String, Object> paraMap) {
        // TODO Auto-generated method stub
        return null;
    }

    /* (non-Javadoc)
     * @see cn.hg.solon.youcan.system.service.ConfigService#update(cn.hg.solon.youcan.system.entity.Config)
     */
    @Tran
    @Override
    public boolean update(Config bean) {
        // TODO Auto-generated method stub
        return false;
    }

}
